import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    component: () => import('../views/NavBar.vue'),
    children: [
       {
        path: '',
        redirect: 'home' // 访问 '/' 自动跳转到 '/home'
      },
      {
        path: 'home',
        name: 'Home',
        component: () => import('../views/HomeView.vue')
      },
      {
        path: 'map',
        name: 'treeMap',
        component: () => import('../views/map/TreeMap.vue')
      },
      {
        path: 'treeInfo',
        name: 'treeInfo',
        component: () => import('../views/tree/TreeInfo.vue')
      },
       {
        path: 'addTree',
        name: 'addTree',
        component: () => import('../views/tree/AddTree.vue')
      },
      {
        path: 'chat',
        name: 'chat',
        component: () => import('../views/ai/Chat.vue')
      },
      {
        path: '/treeDetail/:id',
        name: 'treeDetail',
        component: () => import('../views/tree/TreeDetail.vue')
      },
       {
        path: 'issue',
        name: 'issue',
        component: () => import('../views/tree/issue.vue')
      },
       {
        path: 'personalCenter',
        name: 'PersonalCenter',
        component: () => import('../views/user/PersonalCenter.vue')
      },
        {
        path: 'updatePassword',
        name: 'updatePassword',
        component: () => import('../views/user/UpdatePassword.vue')
      },
       {
        path: 'activity',
        name: 'activity',
        component: () => import('../views/acitvity/ActivityView.vue')
      }
     
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router